import {
	objDeepCopy
} from "@/assets/js/common.js";
let Controller = {
	methods: {
		init() {
			var relId = this.Model.relId;
			this.getMaster(this, relId);
			this.getTagsAll(this, relId)
		},
		//查询标签信详情息
		getMaster(that, id) {
			var apiTest = this.apiTest;
			this.$ajax({
				method: 'get',
				url: apiTest + '/sale/saleGoodsMaster/' + id,
				// url:apiTest+'/sale/saleGoodsMaster/'+id,
			}).then((res) => {
				console.log(res);
				var data = res.data;
				if (data.status == 200) {
					var result = data.result;
					result.is3ex == 1 ? result.is3ex = '是' : result.is3ex = '否';
					that.Model.msgData = objDeepCopy(result);
				} else {

				}

			});
		},
		//查询所有标签组接口
		getTagsAll(that, id) {
			var apiTest = this.apiTest;
			this.$ajax({
				method: 'post',
				url: apiTest + '/sale/saleGoodsMaster/goodsTagList',
				// url:apiTest+'/sale/saleGoodsMaster/goodsTagList',
				data: {
					goodsAttributesId: id
				}
			}).then((res) => {
				console.log(res);
				var data = res.data;
				var obj = {};
				if (data.status == 200) {
					that.Model.listData = [];
					var result = data.result;
					for (var i = 0; i < result.length; i++) {
						obj = objDeepCopy(result[i]);
						that.Model.listData.push(obj);
					}
				} else {

				}

			});
		},
		backStyleInfo() {
			this.$router.push({
				path: 'attrList'
			})
		},
		showMore(row) {
			this.Model.showDetial = true;
		},
		handleSizeChange(val) {

		},
		handleCurrentChange(val) {

		},
		// 
		showChild(val) {
			console.log(val);
		},
		toSearch(val) { //查询
			console.log(val);
		},
		toClear(val) {
			console.log(val);
		},
		toExport(val) {
			console.log(val);
		},

	},
	watch: {
		//
		$route: {
			handler(newValue, oldValue) {
				if (newValue.query.relId) {
					this.getMaster(this, newValue.query.relId);
					this.getTagsAll(this, newValue.query.relId);
				}
			},
			deep: true
		},

	}
}
export default Controller;
